<template>
   <el-form
    style="max-width: 60vw"
    label-width="150px"
    class="stepForm"
    size="mini"
    disabled
  >
    <el-card>
      <h3 style="line-height:50px">基础信息</h3>
      <el-form-item label="商品名称：">
        <el-input :value="detailObj.productName"></el-input>
      </el-form-item>
      <el-form-item label="商品编码：">
        <el-input :value="detailObj.skuCode"></el-input>
      </el-form-item>
      <el-form-item label="款式码：">
        <el-input :value="detailObj.spuCode"></el-input>
      </el-form-item>
      <el-form-item label="颜色及规格：">
        <el-input :value="detailObj.propertiesValue"></el-input>
      </el-form-item>     
      <el-form-item label="国际码：">
        <el-input :value="detailObj.barCode"></el-input>
      </el-form-item> 
      <!-- <el-form-item label="商品分类：">
        <el-input :value="detailObj.rateVal"></el-input>
      </el-form-item> -->
      <el-form-item label="商品简称：">
        <el-input :value="detailObj.shortName"></el-input>
      </el-form-item>
      <el-form-item label="基本售价：">
        <el-input :value="detailObj.salesPrice"></el-input>
      </el-form-item>
      <el-form-item label="成本价：">
        <el-input :value="detailObj.marketPrice"></el-input>
      </el-form-item>
      <el-form-item label="品牌：">
        <el-input :value="detailObj.brand"></el-input>
      </el-form-item>
      <el-form-item label="单位：">
        <el-input :value="detailObj.unit"></el-input>
      </el-form-item>
      <!-- <el-form-item label="供应商名称：">
        <el-input :value="detailObj.rateVal"></el-input>
      </el-form-item>
      <el-form-item label="供货商款号：">
        <el-input :value="detailObj.rateVal"></el-input>
      </el-form-item> -->
    </el-card>
    <el-card class="mt20">
      <h3 style="line-height:50px">图片信息</h3>
      <div class="flex">
        <el-image
            :src="detailObj.pic"
            class="avatar"
            style="width: 200px; height: 150px"
          >
          </el-image>
      </div>
    </el-card>
    <el-card class="mt20">
      <h3 style="line-height:50px">颜色规格</h3>
      <el-table
        border
        :data="detailObj.productSpecsList"
        tooltip-effect="dark"
        style="width: 100%"
        lazy
        >
        <!-- <el-table-column type="selection" width="40" align="center">
        </el-table-column> -->
        <el-table-column prop="propertiesValue" label="商品规格" align="center" width="160"></el-table-column>
        <el-table-column prop="skuCode" label="商品编码" align="center" width="160"></el-table-column>
        <el-table-column prop="barCode" label="国际码" align="center" width="160"></el-table-column>
        <el-table-column prop="salesPrice" label="基本售价" align="center" width="160"></el-table-column>
        <el-table-column prop="marketPrice" label="成本价" align="center" width="160"></el-table-column>
        <el-table-column prop="stockNum" label="主仓实际库存" align="center" width="160"></el-table-column>
      </el-table>
    </el-card>
  </el-form>
</template>

<script>
export default {
  
  data() {
    return {
      detailObj: {}
    }
  },
  watch: {
    id(){
      this.getRate();
    },
  },
  beforeMount() {
    this.getRate();
  },
  props: ["id"],
  methods: {
    getRate() {
      this.loading = true;
      this.$ajax
        .getData("adm/product/getDetail", {id: this.id})
        .then((data) => {
          this.loading = false;
          this.detailObj = data.resData
        })
        .catch((error) => {
          this.loading = false;
          this.$message({
            message: error.codeDes || error.message,
            type: "error",
          });
        });
    },
  },
}
</script>
